/**
 * PieceNotification.java
 * Created: 11.03.2011, 14:57:46
 */
package model;

import client.field.notification.PieceNotificationInterface;

/**
 * A class storing actions, that are sent as a notification in the
 * Observable/Observer pattern. The abstract class supports an index (of a
 * counter) doing some action, a direction and a anchor counter which together
 * specify a target field.
 * @author Jan-Philipp Kappmeier
 */
public abstract class PieceNotification implements PieceNotificationInterface {
	/** The counter that performs an index. */
	private int pieceIndex;
	/** The direction (starting from the anchor field) specifying the target field. */
	private HexDirection direction;
	/** The anchor piece specifying the target field. */
	private int anchorPiece;

	/**
	 * Creates a new instance, specifies the piece causing the action and the
	 * target field. The anchor piece is adjacent to the target field.
	 * @param pieceIndex the index of the piece that performs an action
	 * @param direction the direction of the target field starting at the anchor field
	 * @param anchorPiece the index on the piece on the anchor field.
	 */
	public PieceNotification( int pieceIndex, HexDirection direction, int anchorPiece ) {
		this.pieceIndex = pieceIndex;
		this.direction = direction;
		this.anchorPiece = anchorPiece;
	}

	/**
	 * Returns the direction (from the anchor field to the target field).
	 * @return the direction (from the anchor field to the target field)
	 */
	public HexDirection getDirection() {
		return direction;
	}

	/**
	 * Returns the index of the piece that performs the action.
	 * @return the index of the piece that performs the action
	 */
	public int getPieceIndex() {
		return pieceIndex;
	}

	/**
	 * Returns the index of the anchor piece.
	 * @return the index of the anchor piece
	 */
	public int getAnchorIndex() {
		return anchorPiece;
	}
}
